import request from '@/utils/request'

export function login({ username, password, code, uuid, pharmacyId }) {
  return request({
    url: 'auth/login',
    method: 'post',
    data: {
      username,
      password,
      code,
      uuid,
      pharmacyId
    }
  })
}

export function getInfo() {
  return request({
    url: 'auth/info',
    method: 'get'
  })
}

export function getCodeImg() {
  return request({
    url: 'auth/code',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: 'auth/logout',
    method: 'delete'
  })
}

export function queryStore(account) {
  return request({
    url: 'auth/queryByAccount?username=' + account,
    method: 'post'
  })
}

// 获取当前药房
export function queryStoreName() {
  return request({
    url: 'auth/queryStoreName',
    method: 'get'
  })
}

// 切换药房
export function switchStore(data) {
  return request({
    url: 'auth/switchStore',
    method: 'post',
    data
  })
}
